package chapter8;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2018-03-19 下午4:16
 */
public class TestDemo {
    private static final Logger LOGGER = LoggerFactory.getLogger(TestDemo.class);

    public static void main(String[] args) {
        LOGGER.info("sum:{}", add(1, 3, 4));
        LOGGER.info("sum:{}", add(4, 5, 6, 67, 1));

        Point<String> p = new Point<>();
        p.setX("东经100度");
        p.setY("北纬10度");

        String x = p.getX();
        String y = p.getY();

        LOGGER.info("x坐标:{} y坐标:{}", x, y);

        Color color = Color.RED;
        LOGGER.info("RED index:{}", color.ordinal());
        LOGGER.info("RED name:{}", color.name());
        IMessage message = color;
        LOGGER.info("message:{}", message.getTitle());
        message.fun();

        Point point = new Point();
        point.setX("test");

        ColorC colorC = ColorC.getInstance(1);
        LOGGER.info("colorc:{}", colorC.toString());
        colorC = ColorC.getInstance(2);
        LOGGER.info("colorc:{}", colorC.toString());
    }

    private static int add(int... data) {
        int sum = 0;
        for (int i = 0; i < data.length; i++) {
            sum += data[i];
        }
        return sum;
    }
}
